<?php
 require_once('../Connections/gabriel_paris.php');
 include_once("class/class_img.php");
 include_once("class/SQLString.php");
?>
<?php
 
 /* if not logged in then back to login page */
   session_start();

  if(!isset($_SESSION['is_successful_login']) || $_SESSION['is_successful_login'] == false){ 
    header ('location: index.php'); exit;
  }



$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {	   	    
	
  $updateSQL = sprintf("UPDATE zonas SET nombre=%s
                        WHERE id_zonas = %s",                       
					   GetSQLValueString($_POST['nombre'], "text"),
					   GetSQLValueString($_GET['id_zona'], "text"));

  mysql_select_db($database_gabriel_paris, $gabriel_paris);
  $Result1 = mysql_query($updateSQL, $gabriel_paris) or die(mysql_error());

$insertGoTo = "zonas.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }  
  
   
  header(sprintf("Location: %s", $insertGoTo));
  }
  
$colname_zona_editar = "-1";
if (isset($_GET['id_zona'])) {
  $colname_zona_editar = $_GET['id_zona'];
}

mysql_select_db($database_gabriel_paris, $gabriel_paris);
$query_zona_editar = sprintf("SELECT id_zonas, nombre 
								 FROM zonas
								 WHERE id_zonas = %s",
								 GetSQLValueString($colname_zona_editar, "int"));
$zonas_editar = mysql_query($query_zona_editar, $gabriel_paris) or die(mysql_error());
$row_zonas_editar = mysql_fetch_assoc($zonas_editar);
$totalRows_zonas_editar = mysql_num_rows($zonas_editar);  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/style3.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/vida.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../ckfinder/ckfinder.js"></script>


<title>Gabriel Par&iacute;s</title>
</head>

<body>
<?php include('header.php'); ?>

<div id="container">
<div class="wrapper">

	<div id="contenedor" class="clearfix">
    	<div class="clearfix">
            <div id="sidebar">
                <?php include('menu_propiedades.php'); ?>

            </div>
            <!-- fin Sidebar -->
            
          <div id="contenido">
           <div class="item">
             <h2>Zonas</h2>
            </div> 
            
            <form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1">
              <table width="100%" align="left" >
               <tfoot>
               <tr>
               <td colspan="2" align="right" >
   <input type="button" onclick="javascript:history.back(1)"style="margin-right: 10px" class="classBoton" value="Cancelar" />
   <input type="submit" class="classBoton" value="Guardar" />
              </td>
               </tr>
              </tfoot>
                <tr valign="baseline">
                  <td nowrap="nowrap" align="right">Nombre:</td>                  
                  <td><input type="text" name="nombre" value="<?php echo htmlentities($row_zonas_editar['nombre'], ENT_COMPAT, 'utf-8'); ?>" size="100" style="width:76%" /></td>
                </tr>                                                          
              </table>
              <input type="hidden" name="MM_insert" value="form1" />
            </form>
            <p>&nbsp;</p>
          </div>
        
       	</div>
</div>
</div>
</div>
<?php include('footer.php'); ?>
  </body>
</html>
<?php
//mysql_free_result($prpiedades);
?>


